<template>
  <div class="home-container">
    <!-- 顶部导航栏 -->
    <header class="header">
      <div class="logo">
        <span class="logo-text">统一业务平台</span>
        <span class="logo-version">v0.0.0</span>
      </div>
      <nav class="main-nav">
        <router-link class="nav-item active" to="/">首页</router-link>
        <router-link class="nav-item" to="/applications">子应用管理</router-link>
        <router-link class="nav-item" to="/settings">系统设置</router-link>
        <router-link class="nav-item" to="/help">帮助中心</router-link>
      </nav>
      <div class="user-info">
        <span class="username">管理员</span>
        <button class="logout-btn">退出登录</button>
      </div>
    </header>

    <!-- 主内容区 -->
    <main class="main-content">
      <div class="page-title">
        <h1>系统基座控制台</h1>
        <p>基于乾坤框架的微前端管理平台</p>
      </div>

      <!-- 功能卡片区域 -->
      <div class="card-grid">
        <!-- 子应用管理卡片 -->
        <div class="feature-card" @click="navigateTo('/applications')">
          <div class="card-icon app-icon">
            <i class="icon-apps"></i>
          </div>
          <div class="card-content">
            <h3>子应用管理</h3>
            <p>管理所有注册的子应用，包括注册配置、加载策略和生命周期控制</p>
          </div>
        </div>

        <!-- 路由管理卡片 -->
        <div class="feature-card" @click="navigateTo('/routes')">
          <div class="card-icon route-icon">
            <i class="icon-routes"></i>
          </div>
          <div class="card-content">
            <h3>路由管理</h3>
            <p>统一路由分发、权限控制和历史记录管理</p>
          </div>
        </div>

        <!-- 用户权限卡片 -->
        <div class="feature-card" @click="navigateTo('/permissions')">
          <div class="card-icon perm-icon">
            <i class="icon-permissions"></i>
          </div>
          <div class="card-content">
            <h3>用户与权限</h3>
            <p>基于RBAC模型的用户管理、角色配置和权限分配</p>
          </div>
        </div>

        <!-- 系统配置卡片 -->
        <div class="feature-card" @click="navigateTo('/config')">
          <div class="card-icon config-icon">
            <i class="icon-config"></i>
          </div>
          <div class="card-content">
            <h3>统一配置中心</h3>
            <p>系统参数配置、环境管理和配置版本控制</p>
          </div>
        </div>

        <!-- 资源管理卡片 -->
        <div class="feature-card" @click="navigateTo('/resources')">
          <div class="card-icon resource-icon">
            <i class="icon-resources"></i>
          </div>
          <div class="card-content">
            <h3>资源管理</h3>
            <p>文件存储、资源分类和访问权限控制</p>
          </div>
        </div>

        <!-- 监控告警卡片 -->
        <div class="feature-card" @click="navigateTo('/monitor')">
          <div class="card-icon monitor-icon">
            <i class="icon-monitor"></i>
          </div>
          <div class="card-content">
            <h3>监控与告警</h3>
            <p>系统性能监控、异常检测和告警通知</p>
          </div>
        </div>
      </div>

      <!-- 系统信息面板 -->
      <div class="system-panel">
        <h2>系统状态</h2>
        <div class="status-grid">
          <div class="status-item">
            <span class="status-label">运行状态</span>
            <span class="status-value normal">正常</span>
          </div>
          <div class="status-item">
            <span class="status-label">已注册子应用</span>
            <span class="status-value">0</span>
          </div>
          <div class="status-item">
            <span class="status-label">在线用户</span>
            <span class="status-value">1</span>
          </div>
          <div class="status-item">
            <span class="status-label">系统版本</span>
            <span class="status-value">v0.0.0</span>
          </div>
        </div>
      </div>
    </main>

    <!-- 页脚 -->
    <footer class="footer">
      <p>统一业务平台-系统基座 &copy; 2025</p>
      <p class="quote">"遇见事情要多想。想不出来怎么办？那就再仔细想想。"</p>
    </footer>
  </div>
</template>

<script lang="ts" setup>
import {useRouter} from 'vue-router'

const router = useRouter()

const navigateTo = (path: string) => {
  router.push(path)
}
</script>

<style scoped>
/* 基础样式 */
.home-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  display: flex;
  flex-direction: column;
}

/* 头部样式 */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 70px;
  background-color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: #3498db;
}

.logo-version {
  font-size: 12px;
  color: #999;
  background-color: #f0f0f0;
  padding: 2px 6px;
  border-radius: 4px;
}

.main-nav {
  display: flex;
  gap: 30px;
}

.nav-item {
  text-decoration: none;
  color: #666;
  font-weight: 500;
  padding: 8px 0;
  position: relative;
  transition: color 0.3s ease;
}

.nav-item:hover, .nav-item.active {
  color: #3498db;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: #3498db;
  border-radius: 3px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 20px;
}

.username {
  color: #333;
  font-weight: 500;
}

.logout-btn {
  padding: 6px 16px;
  background-color: #f0f0f0;
  color: #333;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.logout-btn:hover {
  background-color: #e0e0e0;
}

/* 主内容区样式 */
.main-content {
  flex: 1;
  padding: 40px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.page-title {
  text-align: center;
  margin-bottom: 40px;
}

.page-title h1 {
  font-size: 32px;
  font-weight: 700;
  color: #333;
  margin-bottom: 10px;
}

.page-title p {
  font-size: 16px;
  color: #666;
}

/* 功能卡片样式 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

.feature-card {
  background-color: white;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.feature-card:hover {
  transform: translateY(-5px);
}

.card-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.app-icon {
  background: linear-gradient(45deg, #3498db, #2980b9);
}

.route-icon {
  background: linear-gradient(45deg, #9b59b6, #8e44ad);
}

.perm-icon {
  background: linear-gradient(45deg, #1abc9c, #16a085);
}

.config-icon {
  background: linear-gradient(45deg, #f39c12, #d35400);
}

.resource-icon {
  background: linear-gradient(45deg, #e74c3c, #c0392b);
}

.monitor-icon {
  background: linear-gradient(45deg, #34495e, #2c3e50);
}

.icon-apps::before {
  content: '📱';
  font-size: 24px;
  color: white;
}

.icon-routes::before {
  content: '🧭';
  font-size: 24px;
  color: white;
}

.icon-permissions::before {
  content: '🔑';
  font-size: 24px;
  color: white;
}

.icon-config::before {
  content: '⚙️';
  font-size: 24px;
  color: white;
}

.icon-resources::before {
  content: '📦';
  font-size: 24px;
  color: white;
}

.icon-monitor::before {
  content: '📊';
  font-size: 24px;
  color: white;
}

.card-content h3 {
  font-size: 18px;
  color: #333;
  margin-bottom: 10px;
}

.card-content p {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  flex: 1;
}

/* 系统状态面板 */
.system-panel {
  background-color: white;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.system-panel h2 {
  font-size: 20px;
  color: #333;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed #f0f0f0;
}

.status-label {
  color: #666;
}

.status-value {
  font-weight: 600;
  color: #333;
}

.status-value.normal {
  color: #27ae60;
}

/* 页脚样式 */
.footer {
  padding: 30px 40px;
  text-align: center;
  color: #666;
  font-size: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.quote {
  margin-top: 10px;
  font-style: italic;
  color: #888;
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
}

@media (max-width: 768px) {
  .header {
    padding: 0 20px;
  }

  .main-nav {
    display: none;
  }

  .main-content {
    padding: 20px;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .status-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .page-title h1 {
    font-size: 24px;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .user-info .username {
    display: none;
  }
}
</style>
